/*
 * VarValue.cpp
 *
 *  Created on: 17.04.2012
 *      Author: Eugene Kornykhin
 */

#include "VarValue.h"
#include "Number.h"

VarValue::VarValue(string name)
: var(name) {

}

VarValue::~VarValue() {

}

string VarValue::getVar() const {
	return var;
}

void VarValue::execute(Interpreter& interpreter) {
	interpreter.pushPolizElement(Number(interpreter.getVarValue(var)));
}

PolizPosition VarValue::next_position_after(PolizPosition p) const {
	return p.next();
}

bool VarValue::isHalt() const {
	return false;
}

VarValue* VarValue::clone(const Poliz &) const {
	return new VarValue(var);
}

string VarValue::toString() const {
	return "[VALUE OF " + var + "]";
}
